const app = getApp()
Page({
  /**
   * 用户登录
   */
  authorLogin: function (e) {
    if (e.detail.errMsg !== 'getUserInfo:ok') {
      return false;
    }
    wx.showLoading({
      title: '正在登录',
    })
    let pages = getCurrentPages();
    let prevPage = pages[pages.length - 2];
    app.doLogin(e,(login) =>{
      prevPage.setData({
        loginstate:login
      })
      wx.navigateBack({
        delta:1
      })
    });
  },
  /**
   * 返回不登录
   */
  notlogin: function (e) {
    let pages = getCurrentPages();
    let prevPage = pages[pages.length - 2];
    prevPage.setData({
      loginstate:false
    })
    wx.navigateBack({
      delta: 1,
    })
  }
})